<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="embroot.css">
<TITLE>
Introduction
</TITLE>
</HEAD>
<BODY >
<A HREF="embroot059.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot061.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc117">11.1</A>&nbsp;&nbsp;Introduction</H2>

The ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> SQL database interface is a low-level interface to the SQL
language. As far as possible it has been attempted to give the
full power of the SQL interface to the programmer.<BR>
<BR>
A number of features are designed to permit transfer of large amounts
of data with minimal overhead:
<UL CLASS="itemize"><LI CLASS="li-itemize">
The buffered retrieval of multiple tuples from
a relation or view.
<LI CLASS="li-itemize">Buffered multiple updates and inserts
<LI CLASS="li-itemize">Re-use of SQL statements that are parametrised with placeholders.
<LI CLASS="li-itemize">Tuple templates to permit the allocation and re-use of fixed size
buffers.
</UL>
The interface provides safe handles to database cursors. Higher
level interfaces can be constructed on top of this. For
example:
<UL CLASS="itemize"><LI CLASS="li-itemize">
Viewing an SQL query as a predicate that yields
different tuples on backtracking.
<LI CLASS="li-itemize">Viewing an SQL query as a lazily constructed list of tuples.
</UL>
On backtracking, cursors as well as database sessions are automatically
closed. This is required if one is to build abstractions where they
are hidden from the programmer.<BR>
<BR>
Nowhere in the interface are SQL commands ever looked
into. They are always passed straight from the user to the database.
This means that any SQL command supported by the underlying database will
be accessible. Note also any differences in the SQL between different databases
are also not hidden from the user, so the SQL written by the user must be
valid SQL for the database that is being interfaced to.<BR>
<BR>
When retrieving or inserting tuples, tuple templates are used to
specify the types of the different fields being retrieved or
inserted. This allows for a flexible mapping between database
internal types and the tuples retrieved. For example one can
retrieve a date as either a string or an atom. What type combinations
are supported will depend on the underlying database.<BR>
<BR>
It is possible to write SQL queries with parameters (SQL placeholders),
so that one can use the same query several times, with different
values. This feature, together with the availability of any number
of cursors can be used to write complex queries not
expressible with a singe SQL statement.<BR>
<BR>
If the database has a generic binary format, such as Binary Long Object
(BLOB) fields, one can
store and retrieve arbitrary terms in them automatically using the
interface. To exchange
ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> terms with other applications via the database, the terms can
be converted to EXDR data interchange format (see the Embedding and
Interfacing chapter for details) before storing them in the database.<BR>
<BR>
It is possible to open several sessions to different databases
simultaneously. Transactions apply to one session only though.<BR>
<BR>
The code is written so that it will be relatively easy to extend it to
interface to different kinds of databases. The currently supported database is
MySQL.<BR>
<BR>
<HR>
<A HREF="embroot059.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="embroot061.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
